Skip to content

Conversation

@ck768
Copy link
Collaborator

@ck768 ck768 commented Oct 29, 2025

No description provided.

@ck768 ck768 marked this pull request as ready for review January 9, 2026 15:19
]
```

These `.bp` exports can then be viewed in Paraview.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the following subsection, you discuss ParaView in more detail. It might be helpful in this subsection to include a link or brief pointer indicating that the next section will cover how to use ParaView.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The figure would be clearer with units added to the color bar.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree, the point here is to show the "raw" visualisation inside paraview. As in what would the users see if they simply open this file in paraview.

In the Paraview section we can go in details and show how to customise the colourbar etc

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we display the figure with all selectable parameters shown in the drop-down menu?

figure = u_plotter.screenshot("concentration.png")
```

## Plotting the solution for continuous problems ##
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This subtitle seems the same as the previous one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Plotting the solution for continuous problems ##
## Plotting the solution for discontinuous problems ##

Copy link
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ck768 a few comments on my side


# Using PyVista for interactive visualization #

PyVista has many helpful capabilities for 3D visualization based on VTK code, and is used frequently throughout the FESTIM workshop. Users can use PyVista in Jupyter Notebook to visualize fields and meshes interactively.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should state that this is not suitable for transient data. Throughout the workshop we use it to display either steady state data, or the final timestep.

Comment on lines +101 to +102
pyvista.start_xvfb()
pyvista.set_jupyter_backend("html")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is only useful for the workshop on RTD, I would put it in a separate hidden cell

Comment on lines +104 to +109
def make_ugrid(solution):
topology, cell_types, geometry = plot.vtk_mesh(solution.function_space)
u_grid = pyvista.UnstructuredGrid(topology, cell_types, geometry)
u_grid.point_data["c"] = solution.x.array.real
u_grid.set_active_scalars("c")
return u_grid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this function here may be confusing. This is a tutorial on pyvista so let's break things down step by step to make sure readers understand the building blocks

Especially since in this specific example you only use the function once

Comment on lines +111 to +120
u_plotter = pyvista.Plotter()
u_grid = make_ugrid(H.post_processing_solution)
u_plotter.add_mesh(u_grid, cmap="viridis", show_edges=False)
u_plotter.view_xy()
u_plotter.add_text("Hydrogen concentration", font_size=12)
if not pyvista.OFF_SCREEN:
u_plotter.show()
else:
figure = u_plotter.screenshot("concentration.png")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is the pyvista interactive viz tutorial, i think it is extremely important to break this down more granularly.

"First we instanciate a Plotter object, then we use the dolfinx function plot.vtk_mesh with the functionspace of itnerest, here the solution's functionspace to get the topology, the cell_types, the geometry, which are needed to make a pyvista UnstructuredGrid object. Then we attach point data to this grid, etc."

figure = u_plotter.screenshot("concentration.png")
```

## Plotting the solution for continuous problems ##
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Plotting the solution for continuous problems ##
## Plotting the solution for discontinuous problems ##

name: python3
---

# Viewing exports in Paraview #
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Viewing exports in Paraview #
# Visualising fields in Paraview #


+++

## Creating a VTX species export ##
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this code cell we should say what the users should expect to see (ie. the creation of a folder called "paraview/out.bp")


## Creating a VTX species export ##

First, let us run a simple 2D diffusion problem and export a VTK file:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
First, let us run a simple 2D diffusion problem and export a VTK file:
First, let us run a simple 2D diffusion problem and export to VTX:

name: python3
---

# Viewing exports in Paraview #
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the step-by-step guide. We should extend this with:

  • the special case of a 1D field where you need to Plot Over Line
  • some basic paraview features:
    • changing the colourbar
    • slicing (using 3D data)
    • plotting a profile
    • transient data and time controls (play, back, forward...)

Comment on lines +79 to +85
Then, we select our `out.bp` file and press OK on the bottom:

```{image} paraview/paraview_selecting_file.png
:class: bg-primary mb-1
:align: center
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the first time you open a .bp file a pop up windows shows up and you need to select from 2 or 3 readers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants